package ustc.xiaoyang.karl.doublepointer;

public class RemoveElement27 {
    public static void main(String[] args) {

        int [] nums = {3,2,2,3};
        System.out.println(new RemoveElement27().removeElement(nums, 3));
    }
    public int removeElement(int[] nums,int val)
    {
        int slow = 0;
        for (int fast = 0; fast < nums.length; fast++) {
            if(nums[fast] != val){
                nums[slow++] = nums[fast];
            }
        }
//        System.out.println(Arrays.toString(nums));
        return slow;
    }
}
